<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title><!DOCTYPE html>
        <html lang="en" xmlns:th="http://www.thymeleaf.org">
        <head th:replace="admin/common/common_css :: commonHeader('编辑设备')">
        </head>
        <link rel="stylesheet" th:href="@{/js/admin.ui/lib/zTree/v3/css/metroStyle/metroStyle.css}" type="text/css">
<body>
<article class="page-container">
    <form class="form form-horizontal" id="form-knowledge-type-edit">
        <input type="hidden" id="id" name="id" th:value="${e.id }" />


        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>所属区域：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="所属区域（必填）" th:value="${e.ssArea}" id="ssArea" name="ssArea" maxlength="50" />
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>放置地点：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="放置地点（必填）" th:value="${e.fzArea}" id="fzArea" name="fzArea" maxlength="50" />
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>经度：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="经度（必填）" th:value="${e.jd}" id="jd" name="jd" maxlength="50" />
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>纬度：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="纬度（必填）" th:value="${e.wd}" id="wd" name="wd" maxlength="50" />
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>设备名称：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="设备名称（必填）" th:value="${e.name}" id="name" name="name" maxlength="50" />
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>设备编号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="设备编号（必填）" th:value="${e.number}" id="number" name="number" maxlength="50" />
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>设备类型：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <select type="text" class="input-text" id="type" name="type" style="width:200px">
                    <option th:value="1">视频设备</option>
                    <option th:value="2">虫情测报设备</option>
                </select>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>设备型号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="设备型号（必填）" th:value="${e.model}" id="model" name="model" maxlength="50" />
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>端口：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="端口（必填）" th:value="${e.port}" id="port" name="port" maxlength="50" />
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>ip：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="ip（必填）" id="ip" th:value="${e.ip}" name="ip" maxlength="50" />
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>阈值：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="阈值（必填）" th:value="${e.yz}" id="yz" name="yz" maxlength="50" onkeyup="value=value.replace(/[^\d]/g,'')" />
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>状态：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <select type="text" class="input-text" id="state" name="state">
                    <option th:value="1">在线</option>
                    <option th:value="2">离线</option>
                </select>
            </div>
        </div>


        <div class="row cl">
            <div style="text-align: center;">
                <button class="btn btn-primary radius" type="button" onclick="edit();">
                    <i class="Hui-iconfont">&#xe632;</i> 保存
                </button>
                &nbsp;&nbsp;
                <button onClick="layer_close();" class="btn btn-default radius" type="button">
                    &nbsp;&nbsp;取消&nbsp;&nbsp;
                </button>
            </div>
        </div>
    </form>
</article>
<div th:include="admin/common/common_js :: onLoadJS"></div>
<script type="text/javascript" th:src="@{/js/admin.ui/lib/jquery.validation/1.14.0/jquery.validate.js}"></script>
<script type="text/javascript" th:src="@{/js/admin.ui/lib/jquery.validation/1.14.0/validate-methods.js}"></script>
<script type="text/javascript" th:src="@{/js/admin.ui/lib/jquery.validation/1.14.0/messages_zh.js}"></script>
<script type="text/javascript" th:src="@{/js/admin.ui/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js}"></script>
<script type="text/javascript" th:inline="javascript">



    $("#state").val([[${e.state}]]);
    $("#type").val([[${e.type}]]);

    function edit() {
        var ssArea = $("#ssArea").val();
        var fzArea = $("#fzArea").val();
        var jd = $("#jd").val();
        var wd = $("#wd").val();
        var name = $("#name").val();
        var number = $("#number").val();
        var type = $("#type").val();
        var model = $("#model").val();
        var port = $("#port").val();
        var ip = $("#ip").val();
        var yz = $("#yz").val();
        var state = $("#state").val();
        if(ssArea == ''){
            layer.msg('请输入所属区域', {icon: 2});
            return false;
        }else if(fzArea == ""){
            layer.msg('请输入放置区域', {icon: 2});
            return false;
        }else if(jd == ""){
            layer.msg('请输入经度', {icon: 2});
            return false;
        }else if(wd == ""){
            layer.msg('请输入纬度', {icon: 2});
            return false;
        }else if(name == ""){
            layer.msg('请输入设备名称', {icon: 2});
            return false;
        }else if(model == ""){
            layer.msg('请输入设备型号', {icon: 2});
            return false;
        }else if(number == ""){
            layer.msg('请输入设备编号', {icon: 2});
            return false;
        }else if(type == ""){
            layer.msg('请输入设备类型', {icon: 2});
            return false;
        }else if(port == ""){
            layer.msg('请输入端口', {icon: 2});
            return false;
        }else if(ip == ""){
            layer.msg('请输入设备ip', {icon: 2});
            return false;
        }else if(yz == ""){
            layer.msg('请输入阈值', {icon: 2});
            return false;
        }
        send(
            "/pestdiagnosis/sys/pest/editEq",
            $('#form-knowledge-type-edit').serialize(),
            function (data) {
                layer.msg(data.message, {icon: 1,time: 1500}, function() {
                    window.parent.location.href = "/pestdiagnosis/sys/pest/toListEq";
                });
            },
            function (res) {
                layer.msg('网络异常，请稍后再试', {icon: 2});
            }
        );
    }
    // 计算文本域字符长度
    function textareaLength(obj) {
        $('#textareaLengthSpan').text($(obj).val().length);
    }
</script>
</body>
</html></title>
</head>
<body>

</body>
</html>